// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sysin

import (
	"context"
	"github.com/gogf/gf/v2/errors/gerror"
	"hotgo/internal/consts"
	"hotgo/internal/library/hgorm/hook"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"
	"strings"

	"github.com/gogf/gf/v2/os/gtime"
)

// WalletStoreBankUpdateFields 修改商家与银行卡字段过滤
type WalletStoreBankUpdateFields struct {
	StoreId     int64  `json:"storeId"    dc:"商家 id"`
	AccountNum  string `json:"accountNum" dc:"银行卡号"`
	UpdatedBy   int64  `json:"updatedBy"  dc:"最后更新人"`
	BankName    string `json:"bankName" dc:"银行名称"`
	AccountName string `json:"accountName" dc:"开户名"`
}

// WalletStoreBankInsertFields 新增商家与银行卡字段过滤
type WalletStoreBankInsertFields struct {
	StoreId     int64  `json:"storeId"    dc:"商家 id"`
	AccountNum  string `json:"accountNum" dc:"银行卡号"`
	CreatedBy   int64  `json:"createdBy"  dc:"创建人"`
	BankName    string `json:"bankName" dc:"银行名称"`
	AccountName string `json:"accountName" dc:"开户名"`
}

// WalletStoreBankEditInp 修改/新增商家与银行卡
type WalletStoreBankEditInp struct {
	entity.WalletStoreBank
}

func (in *WalletStoreBankEditInp) Filter(ctx context.Context) (err error) {

	return
}

type WalletStoreBankEditModel struct{}

// WalletStoreBankDeleteInp 删除商家与银行卡
type WalletStoreBankDeleteInp struct {
	Id interface{} `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *WalletStoreBankDeleteInp) Filter(ctx context.Context) (err error) {
	return
}

type WalletStoreBankDeleteModel struct{}

// WalletStoreBankViewInp 获取指定商家与银行卡信息
type WalletStoreBankViewInp struct {
	Id int64 `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *WalletStoreBankViewInp) Filter(ctx context.Context) (err error) {
	return
}

type WalletStoreBankViewModel struct {
	entity.WalletStoreBank
	CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建人摘要信息"`
	UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"最后更新人摘要信息"`
}

// WalletStoreBankListInp 获取商家与银行卡列表
type WalletStoreBankListInp struct {
	form.PageReq
	Id         int64         `json:"id"         dc:"id"`
	AccountNum string        `json:"accountNum" dc:"银行卡号"`
	CreatedAt  []*gtime.Time `json:"createdAt"  dc:"创建时间"`
	StoreName  string        `json:"storeName"  dc:"门店名称"`
}

func (in *WalletStoreBankListInp) Filter(ctx context.Context) (err error) {
	in.AccountNum = strings.ReplaceAll(in.AccountNum, " ", "")
	return
}

type WalletStoreBankListModel struct {
	Id             int64             `json:"id"             dc:"id"`
	BankName       string            `json:"bankName"       dc:"银行名称"`
	AccountNum     string            `json:"accountNum"     dc:"银行卡号"`
	CreatedAt      *gtime.Time       `json:"createdAt"      dc:"创建时间"`
	UpdatedAt      *gtime.Time       `json:"updatedAt"      dc:"更新时间"`
	CreatedBy      int64             `json:"createdBy"      dc:"创建人"`
	CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建人摘要信息"`
	UpdatedBy      int64             `json:"updatedBy"      dc:"最后更新人"`
	UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"最后更新人摘要信息"`
	StoreName      string            `json:"storeName"      dc:"门店名称"`
	AccountName    string            `json:"accountName"      dc:"开户名"`
}

// WalletStoreBankExportModel 导出商家与银行卡
type WalletStoreBankExportModel struct {
	Id         int64       `json:"id"         dc:"id"`
	StoreId    int64       `json:"storeId"    dc:"商家 id"`
	BankName   string      `json:"bankName"   dc:"银行名称"`
	AccountNum string      `json:"accountNum" dc:"银行卡号"`
	CreatedAt  *gtime.Time `json:"createdAt"  dc:"创建时间"`
	UpdatedAt  *gtime.Time `json:"updatedAt"  dc:"更新时间"`
	CreatedBy  int64       `json:"createdBy"  dc:"创建人"`
	UpdatedBy  int64       `json:"updatedBy"  dc:"最后更新人"`
}

type WalletStoreBankAPIEditInp struct {
	ID          int64  `json:"id" dc:"id"`
	AccountNum  string `json:"accountNum" v:"required#银行卡号不能为空" dc:"银行卡号"`
	StoreId     int64  `json:"storeId"    v:"required#商家id不能为空"   description:"商家 id"`
	Mobile      string `json:"mobile"     v:"required#手机号不能为空"  dc:"手机号"`
	Code        string `json:"code"       v:"required#验证码不能为空" dc:"验证码"`
	AccountName string `json:"accountName" v:"required#开户名不能为空" dc:"开户名"`
}

func (in *WalletStoreBankAPIEditInp) Filter(ctx context.Context) (err error) {
	in.AccountNum = strings.ReplaceAll(in.AccountNum, " ", "")
	return
}

type WalletStoreBankAPIEditModel struct {
}

type WalletWithdrawInp struct {
	Amount   float64 `json:"amount" v:"required#提现金额不能为空" dc:"提现金额"`
	Platform string  `json:"platform" v:"required#提现平台不能为空" dc:"提现平台：门店-store，用户-user"`
	Type     int     `json:"type" dc:"提现方式：1-银行卡(默认)，2-微信钱包"`
	StoreId  int64   `json:"storeId" dc:"提现门店" `
}

func (in *WalletWithdrawInp) Filter(ctx context.Context) (err error) {
	// 平台设置验证
	if in.Platform != consts.PlatformStore && in.Platform != consts.PlatformUser {
		err = gerror.New("平台设置异常")
		return
	}
	// 设置默认提现方式
	if in.Type == 0 {
		in.Type = consts.WithdrawTypeBank
	}
	return
}
